<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>个人信息完善</title>
    <meta name="renderer" content="webkit" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <link rel="stylesheet" href="/shop/static/layui/css/layui.css" media="all" />
</head>

<body>
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px; width:1100px">
        <legend>个人信息完善</legend>
    </fieldset>
    <form class="layui-form" action="" id="infoForm" lay-filter="example">
        <input type="hidden" name="id" id="id" value="${info.id!'0'}" />
        <div class="layui-form-item">
            <div class="layui-form-item" pane="">
                <label class="layui-form-label">姓名：</label>
                <div class="layui-input-block">
                    <input type="text" name="name" lay-verify="name" value="${info.name!''}" autocomplete="off" placeholder="请输入姓名" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item" pane="">
                <label class="layui-form-label">性别：</label>
                <div class="layui-input-block">
                    <input type="radio" name="sex" lay-verify="required" value="男" title="男" />
                    <input type="radio" name="sex" lay-verify="required" value="女" title="女" />
                    <input type="hidden" id="sysex" value="" lay-verify="sysex" placeholder="" />
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline" pane="">
                    <label class="layui-form-label">年龄：</label>
                    <div class="layui-input-block">
                        <input type="text" name="age" lay-verify="title" value="${info.age!''}" autocomplete="off" placeholder="请输入年龄" class="layui-input" />
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">生日：</label>
                    <div class="layui-input-block">
                        <input type="text" name="birthday" id="date" lay-verify="required|date" value="${info.birthday!''}" autocomplete="off" placeholder="请选择日期" class="layui-input" />
                    </div>
                </div>
            </div>
            <div class="layui-form-item" pane="">
                <label class="layui-form-label">手机：</label>
                <div class="layui-input-block">
                    <input type="text" name="phone" lay-verify="title" value="${info.phone!''}" autocomplete="off" placeholder="请输入手机" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">个人简介：</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入内容" lay-verify="required" class="layui-textarea" name="synopsis">${info.synopsis!''}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" type="button" lay-filter="form">立即提交</button>
                </div>
            </div>
        </div>
    </form>
   <!--  ${UrlUtil.getOption("orderStatus","")} -->
    <script src="/shop/static/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/shop/static/js/common/jquery-2.1.0.min.js"></script>
    <script>
        layui.use(['form', 'layedit', 'laydate'],
            function () {
                var form = layui.form,
                    layer = layui.layer,
                    laydate = layui.laydate;

                //日期
                laydate.render({
                    elem: '#date'
                });
                form.verify({
                    sysex: function (value) {
                        if (value == '') {
                            return "请选择性别！";
                        }
                    }
                });
                //单选监听及过滤事件

                form.on('radio', function (data) {
                    if (data.value == '男' || data.value == '女') {
                        $("#sysex").val(1);
                    }
                });
                form.on('submit(form)', function () {
                        $.ajax({
                            cache: true,
                            type: "POST",
                            url: "/shop/main/saveUpUserInfo",
                            data: $('#infoForm').serialize(),
                            async: false,
                            error: function (request) {
                                    layer.msg('系统错误！');
                                },
                                success: function (data) {
                                    if (data.code = "1") {
                                        layer.msg(data.msg, {
                                            time: 1000
                                        }, function () { //提示框设定显示1秒
                                            location.reload();
                                        })
                                    } else {
                                        layer.msg(data.msg);
                                    }

                                }
                        });
                    })
                    //表单初始赋值
                form.val('example', {
                    "sex": "${info.sex!''}"
                })
            });
    </script>
</body>

</html>